package demo12;

/**
 * Created with IntelliJ IDEA.
 * Description:避免父类构造方法中调用重写的方法
 * User: 86183
 */
class A{
    //构造方法
    public A(){
        func();
        System.out.println("调用父类A的构造方法");
    }
    public void func(){
        System.out.println("调用父类A的func方法");
    }
}
class B extends A{
        public int num = 1;
    public void func(){
        System.out.println("调用子类D的func方法"+"num的值："+num);
    }
}
public class Test1 {
    public static void main(String[] args) {
        B b = new B();
    }
}
